﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using University.Workshop.DataAccess;
using University.Workshop.Model;
using System.Collections.ObjectModel;

namespace University.Workshop.Business
{
    public static class ProductController
    {
        public static bool Register(Product product)
        {
            return ProductDataAccess.AddProduct(product);
        }
        public static bool ValidateCode(string code)
        {
            return ProductDataAccess.ValidateProduct(code);
        }
        public static DataTable LookProduct(string value)
        {
            return ProductDataAccess.LookProducts(value);
        }

        public static bool EditProduct(Product products)
        {
            return ProductDataAccess.EditProductData(products);
        }

        public static bool DeleteProduct(string value)
        {
            return ProductDataAccess.DeleteProductData(value);
        }

        public static bool EnableProduct(string value)
        {
            return ProductDataAccess.EnableProducts(value);
        }
        public static Collection<string> GenerateQuery1GetName()
        {
            DataColumn report = null;
            Collection<string> miCollection = new Collection<string>();
            report = ProductDataAccess.GenerateQuery1();
            foreach (DataRow dr in report.Table.Rows)
            {
                miCollection.Add(dr.ItemArray[0].ToString());
            }
            return miCollection;
        }
        public static Collection<string> GenerateQueryGetQuantity()
        {
            DataColumn report = null;
            Collection<string> miCollection = new Collection<string>();
            report = ProductDataAccess.GenerateQuery2();
            foreach (DataRow dr in report.Table.Rows)
            {
                miCollection.Add(dr.ItemArray[0].ToString());
            }
            return miCollection;
        }
        public static DataTable QuantityAndPriceSale(string code)
        {
            return ProductDataAccess.QuantityAndPrice(code);
        }

        public static DataTable GetPresentation(string code)
        {
            return ProductDataAccess.PresentationProduct(code);
        }

        public static DataTable ReportProductAscendentController()
        {
            return ProductDataAccess.ReportProductAscendent();
        }
    }
}
 